################
# distributions
################
N <- 300
x <- runif(N,0,5)
qtau <- 0.3
beta0 <- 2
beta1 <- -1
##########################################################################
## generated fake data
##########################################################################
set.seed(12345678)
N <- 300
df <- 3
epsilon1 <- rnorm(N) # norm
epsilon2 <- rt(N,df) # t with df 3
epsilon3 <- rchisq(N,df) # chisq with df 3
epsilon4 <- rald(N,0.3) # ald with tau 0.3
epsilon5 <- 2/3*rnorm(N) + 1/3*rnorm(N,sd = 1/10) # mixture of norm: kurtotic
epsilon6 <- 1/2*rnorm(N,-1,2/3) + 1/2*rnorm(N,1,2/3) # bimodal
epsilon7 <- 1/5*rnorm(N,-22/25,1) + 1/5*rnorm(N,-49/125,3/2) + 3/5*rnorm(N,29/250,5/9) # skewed
epsilon8 <- rnorm(N) # heterogeneous
sdx <- (0.5 +  x^(2) )^(-1) # heteroskedasticity
epsilon9 <- rnorm(N,0,sdx) # heteroskedasticity
epsilon10 <- rnorm(N,0,2) # outlier (specified below)

#############################################################
# plot empirical distributions of the error terms
#############################################################
cols <- colorspace::rainbow_hcl(7)
pdf("figures/figure2_appendix.pdf",width=7,height=7)
plot(NA,xlim=c(-2,2),ylim=c(0,1),
     xlab="",
     main="",
     ylab="",
     axes=F)
axis(side=1)
mtext(side=2,line=-2,text="Density")
lines(density(epsilon1),col=cols[1])
lines(density(epsilon2),col=cols[2])
lines(density(epsilon3),col=cols[3])
lines(density(epsilon4),col=cols[4])
lines(density(epsilon5),col=cols[5])
lines(density(epsilon6),col=cols[6])
lines(density(epsilon7),col=cols[7])

legend("topleft",legend = c("Distribution 1",
                            "Distribution 2",
                            "Distribution 3",
                            "Distribution 4",
                            "Distribution 5",
                            "Distribution 6",
                            "Distribution 7"),
       col=cols,lty=rep(1,7),bty = "n",cex=0.9)
dev.off()

